package cn.hjm.hrm.feign.client;

import cn.hjm.hrm.domain.Productstore;
import cn.hjm.hrm.dto.ProductDto;
import cn.hjm.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class StoreFeginFallBack implements FallbackFactory<StoreFeginClient> {

    @Override
    public StoreFeginClient create(Throwable throwable) {
        return new StoreFeginClient() {
            @Override
            public Productstore getById(Long id) {
                return new Productstore(-1L,-1L,-1L);
            }

            @Override
            public AjaxResult getNumber(ProductDto productDto) {
                return AjaxResult.me().setSuccess(false).setMessage("库存没了没了！！");
            }
        };
    }
}
